<?php

namespace App\Http\Controllers\Kms\App\Album;

use App\Http\Controllers\BaseController;
use App\Http\Validate\Kms\Album\AlbumMainValidate;
use App\Service\Kms\Album\AlbumMainService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class AlbumMainController extends BaseController
{
    /**
     * @param Request $request
     * @return JsonResponse
     * @throws ValidationException
     */
    public function main(Request $request): JsonResponse
    {
        return $this->success(AlbumMainService::main());
    }

    /**
     * @return JsonResponse
     * @throws ValidationException
     */
    public function groupList(): JsonResponse
    {
        return $this->success(AlbumMainService::groupList());
    }


    /**
     * @param Request $request
     * @return JsonResponse
     * @throws ValidationException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function groupShare(Request $request): JsonResponse
    {
        $params = AlbumMainValidate::groupShareValidate($request->all());
        AlbumMainService::groupShare($params);
        return $this->success();
    }
}
